package cn.com.nes.site.entity.dto;

import cn.hutool.core.util.StrUtil;

import java.math.BigDecimal;

/**
 * @author yueb
 * @date 2019-09-03 15:38
 */
public class ResultCodeDto {

    private String code;

    private String name;

    private String temperatureCode;

    private Integer maxValue;

    private Integer minValue;

    private String field;

    private String temperatureValue;

    private String original_value;

    public ResultCodeDto() {
    }

    public ResultCodeDto(String code, String name, String temperatureCode, Integer maxValue, Integer minValue, String field, String temperatureValue, String original_value) {
        this.code = code;
        this.name = name;
        this.temperatureCode = temperatureCode;
        this.maxValue = maxValue;
        this.minValue = minValue;
        this.field = field;
        this.temperatureValue = temperatureValue;
        this.original_value = original_value;
    }

    public static ResultCodeDto createTempControl(String modelName, String value, String field, String temperatureCode,
                                                  int max, int min){
        return new ResultCodeDto("0201", modelName, temperatureCode, max, min, field, "", value);
    }

    public void setMaxValue(String value) {
        if (StrUtil.isNotBlank(value)) {
            this.maxValue = (new BigDecimal(value)).intValue();
        }
    }

    public void setMinValue(String value) {
        if (StrUtil.isNotBlank(value)) {
            this.minValue = (new BigDecimal(value)).intValue();
        }
    }

    public void setMaxValue(int maxValue) {
        this.maxValue = maxValue;
    }

    public void setMinValue(int minValue) {
        this.minValue = minValue;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTemperatureCode() {
        return temperatureCode;
    }

    public void setTemperatureCode(String temperatureCode) {
        this.temperatureCode = temperatureCode;
    }

    public Integer getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(Integer maxValue) {
        this.maxValue = maxValue;
    }

    public Integer getMinValue() {
        return minValue;
    }

    public void setMinValue(Integer minValue) {
        this.minValue = minValue;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getTemperatureValue() {
        return temperatureValue;
    }

    public void setTemperatureValue(String temperatureValue) {
        this.temperatureValue = temperatureValue;
    }

    public String getOriginal_value() {
        return original_value;
    }

    public void setOriginal_value(String original_value) {
        this.original_value = original_value;
    }
}
